package ca.liu.study.springdata.jpa.domain;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.OneToMany;

import ca.liu.study.springdata.jpa.domain.superclass.People;

@Entity
public class Teacher extends People {
	
	@OneToMany(mappedBy = "teacher")
	private List<Course> courses;

	public Teacher() {
		courses = new ArrayList<Course>();
	}
	
	public Teacher(String firstName, String lastName, String email) {
		super(firstName, lastName, email);
		courses = new ArrayList<Course>();
	}
	
	public List<Course> getCourses() {
		return courses;
	}
	
	public String toString() {
		return super.toStringHelper().add("courses.size", courses.size()).toString();
	}
}
